Skip to content

Conversation

@AustinMroz
Copy link
Collaborator

@AustinMroz AustinMroz commented Dec 2, 2025

A now functional WIP branch.

Built on top of the vue control_after_generate branch. ~300 lines of actual change. Likely best rebased after control_after_generate changes are merged.

┆Issue is synchronized with this Notion page by Unito

I would prefer that valueRef used the TValue generic, but that causes
many, many awful errors. This is far preferable
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 2, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch austin/reactive-cag

Comment @coderabbitai help to get the list of available commands and usage tips.

@DrJKL DrJKL changed the base branch from main to austin/vue-control-after-generate December 2, 2025 09:42
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

🎭 Playwright Test Results

Some tests failed

⏰ Completed at: 12/02/2025, 08:52:20 PM UTC

📈 Summary

  • Total Tests: 489
  • Passed: 471 ✅
  • Failed: 4 ❌
  • Flaky: 5 ⚠️
  • Skipped: 9 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 462 / ❌ 4 / ⚠️ 5 / ⏭️ 9
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 6 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 12/02/2025, 08:14:20 PM UTC

🔗 Links


🎉 Your Storybook is ready for review!

* Validates that a value is a valid WidgetValue type
*/
function validateWidgetValue(value: unknown): WidgetValue {
if (value === null || value === undefined || value === void 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check, but...

Suggested change
if (value === null || value === undefined || value === void 0) {
if (!value) {

or == null?

/**
* Validates that a value is a valid WidgetValue type
*/
function validateWidgetValue(value: unknown): WidgetValue {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a good place to do more type level validation.

Comment on lines +138 to +140
const cagRef = ref<ControlWidgetOptions>(
validateControlWidgetValue(cagWidget.value)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we talked about here, validate via a computed maybe?

set(v) {
reactiveInputs.splice(0, reactiveInputs.length, ...v)
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be in LGraphNode with a get/set.

undefined,
inputData
)
if (this.widgets?.[1]) widget.linkedWidgets = [this.widgets[1]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a one-line PR. Quick fix.

/** Widget type (see {@link TWidgetType}) */
type: TType
value?: TValue
valueRef?: () => Ref<boolean | number | string | object | undefined>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be able to get this to work if you use NoInfer

Comment on lines +56 to +58
input.default !== undefined
? input.default
: input.type === 'COMBO' &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional:

Suggested change
input.default !== undefined
? input.default
: input.type === 'COMBO' &&
input.default ?? input.type === 'COMBO' &&

icon: 'pi pi-link',
title: 'linkToGlobal',
description: 'linkToGlobalDesc'
} satisfies ControlOption
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check the need for assertions here.

Comment on lines +71 to +72
if (props.controlWidget().value === mode) return
props.controlWidget().value = mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another place to try to use MaybeRefOrGetter

<WidgetWithControl
v-else-if="widget.controlWidget"
:comp="WidgetSelectDefault"
:widget="widget as SimplifiedControlWidget<string>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +16 to +17
const valueRef = ref(value)
if (callback) watch(valueRef, (v) => callback(v))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const valueRef = ref(value)
if (callback) watch(valueRef, (v) => callback(v))
if (callback) watch(() => value, (v) => callback(v))

<Button
variant="link"
size="small"
class="h-4 w-7 self-center rounded-xl bg-blue-100/30 p-0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colors should be in the theme with named tokens.

Comment on lines +57 to +58
export type SimplifiedControlWidget<T extends WidgetValue = WidgetValue> =
SimplifiedWidget<T> & Required<Pick<SimplifiedWidget<T>, 'controlWidget'>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe...

Suggested change
export type SimplifiedControlWidget<T extends WidgetValue = WidgetValue> =
SimplifiedWidget<T> & Required<Pick<SimplifiedWidget<T>, 'controlWidget'>>
export interface SimplifiedWidgetWithControl<T extends WidgetValue = WidgetValue> extends SimplifiedWidget<T> {
controlWidget: SimplifiedWidget<T>['controlWidget']
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll find a good way to structure the types here.

Comment on lines +31 to +32
const valueRef = ref(value)
if (callback) watch(valueRef, (v) => callback(v))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same getter for watch here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants